import originAxios from 'axios'

export default function axios(config) {

    const instance = originAxios.create({
        baseURL: 'http://127.0.0.1:8999/api/private/v1/',
        timeout: 2000,
    })

    // axios请求拦截
    instance.interceptors.request.use(config => {
        // 为请求头对象，添加 Token 验证的 Authorization 字段
        config.headers.Authorization = window.sessionStorage.getItem('token')
        return config
    })

    return instance(config)
}